<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>Spring 3 MVC Series - Employee Manager</title>
</head>
<body>
 
<h2>Employee Manager</h2>
 
<form:form method="post" action="add.html" commandName="employee">
 
    <table>
    <tr>
        <td><form:label path="firstName"><spring:message code="label.firstname"/></form:label></td>
        <td><form:input path="firstName" /></td>
    </tr>
    <tr>
        <td><form:label path="lastName"><spring:message code="label.lastname"/></form:label></td>
        <td><form:input path="lastName" /></td>
    </tr>
    <tr>
        <td><form:label path="emailId"><spring:message code="label.email"/></form:label></td>
        <td><form:input path="emailId" /></td>
    </tr>
    <tr>
        <td><form:label path="phoneNumber"><spring:message code="label.telephone"/></form:label></td>
        <td><form:input path="phoneNumber" /></td>
    </tr>
    <tr>
        <td colspan="2">
            <input type="submit" value="<spring:message code="label.addEmployee"/>"/>
        </td>
    </tr>
</table> 
</form:form>
 
     
<h3>Employees</h3>
<c:if  test="${!empty employeeList}">
<table class="data">
<tr>
    <th>Name</th>
    <th>Email</th>
    <th>Telephone</th>
    <th>&nbsp;</th>
</tr>
<c:forEach items="${employeeList}" var="employee">
    <tr>
        <td>${employee.lastName}, ${employee.firstName} </td>
        <td>${employee.emailId}</td>
        <td>${employee.phoneNumber}</td>
        <td><a href="delete/${employee.employeeId}">delete</a></td>
    </tr>
</c:forEach>
</table>
</c:if>
<c:if  test="${empty employeeList}">
 <h4>No Employees</h4>
 </c:if>
</body>
</html>